# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: Ronald van Haren <ronald@archlinux.org>
# Contributor: Stefan Husmann <stefan-husmann@t-online.de>
# Contributor: Jason Taylor <jftaylor21@gmail.com>
# Contributor: Darwin Bautista <djclue917@gmail.com>

pkgname=qhull
pkgver=2020.2
_pkgver=8.0.2
pkgrel=4
pkgdesc="A general dimension code for computing convex hulls and related structures"
arch=(loong64 x86_64)
url="http://www.qhull.org/"
license=(custom)
depends=(glibc)
makedepends=(cmake)
source=("http://www.qhull.org/download/qhull-${pkgver%.*}-src-$_pkgver.tgz")
sha256sums=('b5c2d7eb833278881b952c8a52d20179eab87766b00b865000469a45c1838b7e')

build() {
  cmake -B build -S $pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build
  cmake --build build --target libqhull # deprecated, needed by octave
}

package() { 
  DESTDIR="$pkgdir" cmake --install build
  cp -P build/libqhull.so* "$pkgdir"/usr/lib/

  # Install license
  install -Dm644 "$srcdir"/$pkgname-$pkgver/COPYING.txt -t "$pkgdir"/usr/share/licenses/$pkgname/
}
